package com.distribute.core.utils;

import io.netty.buffer.ByteBuf;

/**
 * 字节工具
 *
 * @author chennengcheng
 * @date 2021-09-13 9:54
 * @remark
 */
public class ByteUtils {

    /**
     * 字节转字符
     * @param byteBuf
     * @return
     */
    public static String byteToStr(ByteBuf byteBuf){
        byte[] result = new byte[byteBuf.readableBytes()];
        // 将数据读取到 result1
        byteBuf.readBytes(result);
        return new String(result);
    }

}
